home *** CD-ROM | disk | FTP | other *** search
- Path: Austria.EU.net!pctpg7
- From: paumann@apars1.apa.co.at (Mario Paumann)
- Newsgroups: comp.sys.hp.hpux,comp.lang.c++,de.comp.lang.c++
- Subject: HP-UX 10.01 C++ : Bug in fstream Library ?
- Date: Mon, 29 Jan 96 15:39:13 GMT
- Organization: APA - Austrian Press Agency
- Message-ID: <4ei4hd$6ov@news.Austria.EU.net>
- NNTP-Posting-Host: pctpg7.apa.co.at
- X-Newsreader: News Xpress Version 1.0 Beta #3
-
- Hi !
-
- Have someone recognized a problem
- with files in input and output mode
- when reading to the end of the file
- and then want to write something to
- the file ?
-
- Try the following (command line) with the
- Example (see end of posting) compiled to a.out :
-
- $ echo test >dingsda
- $ a.out
- $ wc -l dingsda
- $ cat dingsda
-
- ok. dingsda got 40 lines with the same string
- in it ("1234567890_12\n").
- But then try this.
-
- $ rm dingsda
- $ a.out
- $ wc -l dingsda
- $ cat dingsda
-
- you will get _one line_ with the above string
- in it !?!?
-
- When shortening the above string with one
- character to "1234567890_1\n" both command
- line examples above will work like expected
- (40 lines are generated) !
-
-
- Someone ever hit this bug ?
- Maybe there is a patch ?
- Please help !
-
- Thanx, mario
-
-
-
- a.out source :
- --------------
-
- #include <iostream.h>
-
- main()
-
- { fstream mylog;
- char i[1024];
-
- mylog.open("dingsda", ios::in | ios::out);
-
- // Reading
- mylog >> i;
-
- // Writing
- // !!!!! Take care about the length of the string !!!!!!
- for (int j=0; j<40; j++)
- mylog << "1234567890_12\n;
-
- return 0;
- }
-
- --------------------------------------
- Fuer de.comp.lang.c++ Zuschauer :
- Tut mir leid, dass ich englisch geschrieben
- habe, aber ich wollte es auch in englische
- newsgroups posten. Danke !
-